[% setvar title Structured Internal Representation of Filenames %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>Structured Internal Representation of Filenames</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>  Maintainer: Jarkko Hietaniemi &lt;<a href='mailto:jhi@iki.fi'>jhi@iki.fi</a>&gt;
  Date: 4 Aug 2000
  Mailing List: <a href='mailto:perl6-internals@perl.org'>perl6-internals@perl.org</a>
  Number: 36
  Version: 1
  Status: Developing</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p>Wherever Perl internally uses filenames (in a very inclusive sense:
filenames, directory names, whatever) the components of the file name
should be stored in a platform-neutral structured format.</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<p>Perl is great at munging data and in general Perl scripts are very
portable.  Howevere, before one gets to it one usually has to open
some files and the results have to put somewhere.  The naming of files
(&quot;files&quot; here meant in the most inclusive possible sense, the Unix
sense where everything has a name: naming of persistent storage
objects, if you wll) is however one of the most unportable things
there is.</p>
<p>A filename may have directory part, filename part, suffixes, volume
names, version numbers.  The component separators are different and
there may be several even on a single platform.  There may be one or
more root directories, the notation for parent directory varies, and
so on.</p>
<a name='IMPLEMENTATION'></a><h1>IMPLEMENTATION</h1>
<p>Perl core functions should pass filenames to and from each other as
structures that contain the components of filenames in a structure.
To be as future-proof as possible, the components could probably be in
Unicode.  For native use (when actually accessing the filesystem
layer) and for performance a ready-to-be-used concatenated
representation can be created on demand.  Because the filename is
already in parsed form, manipulation of the name is much easier and
cleaner than currently.  Conversion between the file naming
conventions of various operating systems would become almost trivial.</p>
<p>A vague possibility: the proposed internal format could be designed to
be flexible enough to present also URLs/URIs.</p>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<pre>  perlport manpage for discussion of filenames
  File::Spec
  File::Basename</pre>
</div>
